/* Author ywl
* Description:
1.列表展示组件
2.slot: headerLeft =>表格顶部左侧信息;controlsBtn => 为表格列表操作列插槽
3.dicType: 列表配置动态字典类型值
4.dicProp: 列表配置动态字典的枚举字段
5.filter: 列表配置固定枚举对象
6.colOptionEnum: 动态枚举字典选项集合
7.handlerClick: 列表表格内点击事件
8.isSelection: 是否展示列表多选框 默认true
9.isClearSelection: 是否在列表数据刷新时清除勾选状态 默认true
10.isMarClass: 是否展示列表顶部信息或者按钮
11.isShowTooltip: 是否在鼠标悬浮时展示信息
12.cell-click: 单元格点击事件
*/
<template>
  <div :class="['myTable']" style="width: 100%;height: 100%">
    <el-table
      ref="tableRef"
      style="width: 100%;"
      :data="getTable"
      size="small"
      :current-row-key="id"
      :empty-text="emptyText"
      row-class-name="row"
      :cell-class-name="cellClassName"
      tooltip-effect="dark"
      :highlight-current-row="true"
      fit
      border
      :row-key="getRowkey"
      :tree-props="{ children: 'childNodeList' }"
      :expand-row-keys="getExpandRowKeys"
      :cell-style="eidtStyle"
      @selection-change="handleSelectionChange"
      @cell-click="handlerClick"
    >
      <!--这是是为了将表格设置成带有选择框的表格-->
      <el-table-column
        v-if="isSelection"
        :selectable="checkSelectable"
        class="selection"
        type="selection"
        :reserve-selection="true"
        align="center"
        width="45"
      />
      <!-- 序号的表头 -->
      <el-table-column align="center" type="index" label="序号" width="50" />
      <el-table-column v-if="activeName === '物资明细信息'" align="center" type="expand" width="1">
        <template slot-scope="scope">
          <el-form label-position="left" inline class="demo-table-expand">
            <el-form-item
              v-for="(content, index) in expandList"
              :key="index"
              :label="content.label"
              :class="content.style"
            >
              <el-tooltip :content="String(scope.row[content.props])">
                <span class="headers-tooltips">{{ scope.row[content.props] }}</span>
              </el-tooltip>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
      <el-table-column
        v-for="(item, index) in columns "
        :key="index"
        align="center"
        :prop="item.prop"
        :width="item.width"
        :label="item.label"
        :show-overflow-tooltip="false"
      >
        <!-- 判断一级是否可以编辑单元格 -->
        <template slot-scope="scope">
          <div v-if="!item.checkbox">
            <el-input
              v-if="scope.row.id === editIndex && item.edit"
              ref="tableInput"
              v-model="scope.row[item.prop]"
              class="pms-wz-input el-table-inline"
              size="mini"
              @blur="removeClass(item.prop, scope.$index, scope.row)"
              @change="changeInput(item.prop, scope.$index, scope.row)"
            />
            <!-- 单元格显示的内容 -->
            <el-tooltip
              :disabled="item.isshowBtn"
              :content="scope.row['hanaAeq'] ? String(filterChilNodeList(scope.row, item)) : String(formatInput(scope.row[item.prop], item))"
            >
              <span
                :class="['header-tooltip', item.isshowBtn ? scope.row[item.prop] === '1' ? 'look' : 'edits' : '']"
                @click="operationClick(scope.row[item.prop], scope.row, item.isshowBtn)"
              ><span
                v-if="isShowPrice(item, scope.row)"
              >合计:</span>{{ scope.row['hanaAeq'] ?
                filterChilNodeList(scope.row, item) :
                formatInput(scope.row[item.prop], item) }}</span>
            </el-tooltip>
          </div>
          <!-- 是否展示checkbox "-->
          <el-checkbox
            v-else-if="!scope.row.childNodeList"
            :value="isExist(scope.row[item.prop])"
            disabled
            @change="(val) => selectChange(val, item.prop)"
          />
        </template>
        <!-- 是否存在二级表头 -->
        <el-table-column
          v-for="( childrens, _index ) in item.children "
          :key="_index"
          align="center"
          :prop="childrens.prop"
          :width="childrens.width"
          :label="childrens.label"
          :show-overflow-tooltip="false"
        >
          <!-- 二级是否可以编辑单元格 -->
          <template slot-scope="scope">
            <el-input
              v-if="scope.row.id === editIndex && childrens.edit"
              ref="tableInput"
              v-model="scope.row[childrens.prop]"
              class="pms-wz-input el-table-inline"
              size="mini"
              @blur="removeClass(childrens.prop, scope.$index, scope.row)"
              @change="changeInput(childrens.prop, scope.$index, scope.row)"
            />
            <el-tooltip :content="String(formatInput(scope.row[childrens.prop]))">
              <span :class="['header-tooltip']">{{ formatInput(scope.row[childrens.prop]) }}</span>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table-column>
      <!-- 服务明细需要展示的列 fixed="right"-->
      <el-table-column
        v-for="( _item ) in servicesColumns"
        :key="_item.id"
        fixed="right"
        align="center"
        :prop="_item.prop"
        :width="_item.width"
        :label="_item.label"
        :show-overflow-tooltip="false"
      >
        <template slot-scope="scope">
          <el-select
            v-if="scope.row['childNodeList']"
            v-model="scope.row[_item.dicProp.label]"
            :disabled="ischange ? ischange : isDisableShow(scope.row, _item.prop)"
            filterable
            placeholder="请选择"
            allow-create
            @focus="getDatalist(scope.row, _item.prop)"
            @change="handleOnEvent(_item.prop, scope.row, scope.row[_item.dicProp.label], _item.type)"
          >
            <el-option
              v-for=" optionItem in servicesSelect[_item.type] "
              :key="optionItem[_item.dicProp.value]"
              :label="optionItem[_item.dicProp.label]"
              :value="optionItem[_item.dicProp.value]"
            />
          </el-select>
        </template>
      </el-table-column>
      <slot name="controlsBtn" />
    </el-table>
  </div>
</template>

<script>
import { expandList, regex, editColor, showChildList, servicesColor, shouleChineseTitle, noAllodZeroList } from '../index.js'
import store from '@/store'
// import VeriFication from '../VeriFication.js'
// const { OnCellBeginEdit } = VeriFication()
import {
  getWFWorkItem
} from '@/api/actualBudget/index'
export default {
  name: 'MyTable',
  // 因为是子组件，要接受父组件传递的数据，所以这里我们定义props
  props: {
    // 返回数据id
    id: {
      type: [String, Number],
      required: true,
      default: ''
    },
    // 父组件传递过来的表格数据
    tableData: {
      type: Array,
      default: () => []
    },
    // 父组件传递过来的表头数据
    columns: {
      type: Array,
      default: () => []
    },
    // 父组件传递过来的操作按钮数据
    tableOperation: {
      type: Array,
      default: () => []
    },
    // 列表数据枚举字段选项集
    colOptionEnum: {
      type: Object,
      default: () => ({})
    },
    // 是否展示列表多选框 默认true
    isSelection: {
      type: Boolean,
      default: false
    },
    // 是否展示列表顶部信息或者按钮
    isMarClass: {
      type: Boolean,
      default: false
    },
    // 是否在列表数据刷新时清除勾选状态 默认true
    isClearSelection: {
      type: Boolean,
      default: true
    },
    // 暂无数据提示
    emptyText: {
      type: String,
      default: '暂无数据'
    },
    // 是否显示fixed 最后一行粘性定位
    isShowFixed: {
      type: Boolean,
      default: false
    },
    // 服务商需要展示的表头
    servicesColumns: {
      type: Array,
      default: () => []
    },
    // 服务商下拉框字典数据
    servicesSelect: {
      type: Object,
      default: () => ({})
    },
    // 当前是物资/服务
    activeName: {
      type: String,
      default: ''
    },
    // index 下标不准确
    ischange: {
      type: Boolean,
      default: false
    },
    urlData: {
      type: Object,
      default: () => ({})
    },
    // 子专业是否可以编辑
    isSubCheckEidt: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      // 展开行显示的信息表头
      expandList,
      eventName: 'click', // 点击按钮绑定的方法，这样写法也可以去绑定一些其他的比如change等方法
      multipleSelection: [], // 这个数组用来保存被选择行的数据，顺序是按照你勾选的顺序来排序的
      temporary: '', // 上次保存的单元格数据
      editIndex: '-1', // 是否可以编辑单元格index
      currentNode: ''// 当前节点
    }
  },
  computed: {
    // 表格获取 需要唯一id 所以 在这里动态加上
    getTable() {
      this.tableData.forEach(item => {
        if (!item.id) {
          if (item.childNodeList) {
            item.childNodeList.forEach(i => {
              i['id'] = this.generateRandomId()
            })
          }
          item['id'] = this.generateRandomId()
        }
      })
      console.log(this.tableData, '???')
      return this.tableData
    },
    // 默认展开的二级表格行
    getExpandRowKeys() {
      const listID = this.activeName === '服务明细信息' ? this.findIds(this.tableData) : []
      return listID
    }
  },
  watch: {
    // 监听表格数据是否发生改变并清空
    tableData: {
      handler(newVal) {
        if (newVal.length && this.isClearSelection) {
          this.$refs.tableRef.clearSelection()
        }
      },
      deep: true
    }
  },
  created() {
    this.cellIsEdits()
  },
  methods: {
    // 多选框是否可以被选中
    checkSelectable() {
      const { type, workItemId } = this.urlData
      if (type === 'done' || !workItemId) {
        return false
      } else {
        return true
      }
    },
    // 处理服务商子节点有些名称不显示
    filterChilNodeList(row, item) {
      let val = ''
      if (showChildList.includes(item.prop)) {
        val = ''
      } else {
        val = row[item.prop]
      }
      return val
    },
    // 当前单元格是否可以编辑 添加样式
    eidtStyle(row) {
      return this.currentNode !== 'sett_01' && this.currentNode !== 'confirm_01' ? '' : this.activeName === '物资明细信息' ? this.materialBeforeEdit(row) : this.servicesBeforeEdit(row)
    },
    // 物资单元格编辑之前需要展示是否可以编辑 2024.9.29优化代码
    materialBeforeEdit(row) {
      if (this.currentNode !== 'sett_01') {
        return ''
      }
      const editableProperties = [
        { property: 'changeNum', columnIndex: 10 },
        { property: 'usableStorage', columnIndex: 11 },
        { property: 'unUsableStorage', columnIndex: 12 },
        { property: 'notUsableStorage', columnIndex: 13 },
        { property: 'notUnusableStorage', columnIndex: 14 },
        { property: 'storeManNum', columnIndex: 16 },
        { property: 'storageAddress', columnIndex: 17 }
      ]
      const { row: currentRow, columnIndex } = row
      const res = editableProperties.filter(prop => {
        const saveIds = this.OnCellBeginEdit(currentRow, { property: prop.property }, this.activeName, this.getTable, this.currentNode)
        return saveIds && saveIds.includes(currentRow.id)
      })

      const editableProp = res.find(prop => prop.columnIndex === columnIndex)
      if (editableProp) {
        return 'background: #fffaee'
      } else {
        return ''
      }
    },
    // 2024.9.29优化代码
    servicesBeforeCodeYouHua() {
      const list = [
        { property: 'adjustedPrice', columnIndex: this.currentNode === 'sett_01' ? 11 : 10 },
        { property: 'changePrice', columnIndex: this.currentNode === 'sett_01' ? 17 : 16 },
        { property: 'changeNum', columnIndex: this.currentNode === 'sett_01' ? 18 : 17 },
        { property: 'returnInforMation', columnIndex: 23 }
      ]
      return list
    },
    // 服务单元格编辑之前需要展示是否可以编辑 2024.9.29优化代码
    servicesBeforeEdit(row) {
      // 可以编辑的单元格属性及其对应的列索引
      const editableProperties = this.servicesBeforeCodeYouHua()
      const NODE_TYPES = ['sett_01', 'confirm_01']
      // 如果当前节点不是 'sett_01' 或 'confirm_01'，或者行有子节点，则不可编辑
      if (!(NODE_TYPES.includes(this.currentNode)) || row.row.childNodeList) {
        return ''
      }

      // 检查是否可编辑，并构建可编辑属性与ID的映射
      const editableMap = {}
      editableProperties.forEach(prop => {
        const saveId = this.OnCellBeginEdit(row.row, prop, this.activeName, this.getTable, this.currentNode)
        if (saveId) {
          editableMap[prop.property] = saveId
        }
      })

      // 根据列索引和属性判断是否应用编辑样式
      for (let i = 0; i < editableProperties.length; i++) {
        const prop = editableProperties[i]
        if (editableMap[prop.property] === row.row.id && row.columnIndex === prop.columnIndex) {
          return 'background: #fffaee' // 应用编辑样式
        }
      }

      return '' // 不应用编辑样式
    },
    // 服务单元格编辑之前需要展示是否可以编辑
    // 需要拿到默认展开的id方法
    findIds(arr) {
      let ids = []
      arr.forEach(item => {
        if (item.id) {
          ids.push(item.id)
        }
        if (item.childNodeList) {
          ids = ids.concat(this.findIds(item.childNodeList))
        }
      })
      return ids
    },
    // 展示小数的位数
    formatNumber(inputValue, decimalPlaces) {
      let formattedValue
      if (Number.isInteger(inputValue)) {
        formattedValue = `${inputValue}.${'0'.repeat(decimalPlaces)}`
      } else {
        formattedValue = Number.isInteger(inputValue) ? inputValue?.toFixed(decimalPlaces) : inputValue
      }
      return formattedValue
    },
    /**
     *
     * @param {*} input 传入的值
     * return s {*} 返回处理后的值
     */
    formatInput(input, row) {
      if (row?.isshowBtn) {
        return input === '1' ? '查看' : '编辑'
      } else {
        // 四位小数
        const fourDecimal = ['amount', 'taxRate']
        // 两位小数
        const twoDecimal = ['equipSum', 'taxAmount', 'amt', 'changePrice', 'doneAmt', 'adjustedPrice']
        if (row !== undefined && fourDecimal.includes(row.prop) && input !== undefined && input !== null) {
          return this.formatNumber(Number(input), 4)
        } else if (row !== undefined && twoDecimal.includes(row.prop) && input !== undefined && input !== null) {
          return input
        } else {
          return input
        }
      }
    },
    // 获取随机id
    generateRandomId(length = 8) {
      // const chars = '0123456789'
      // let result = ''
      // for (let i = 0; i < length; i++) {
      //   result += chars[Math.floor(Math.random() * chars.length)]
      // }
      // return result
      const chars = '0123456789'
      let result = ''
      const arr = new Uint8Array(length)
      window.crypto.getRandomValues(arr)
      for (let i = 0; i < length; i++) {
        // 注意：Uint8Array中的值范围是0-255，所以我们需要将其转换为字符集的有效索引
        const idx = arr[i] % chars.length
        result += chars[idx]
      }
      return result
    },
    // 获取表格唯一的key
    getRowkey(row) {
      return row.id
    },
    // @selection-change方法可以监听到表格里哪一行被选中，类型是数组;
    // 然后我们将它赋值给定义好的 multipleSelection
    handleSelectionChange(rowList) {
      this.multipleSelection = rowList
      this.$emit('handleSelection', rowList)
      store.commit('settings/setTableCheckData', rowList)
    },
    // 清空选中
    clearSelection() {
      this.$refs.tableRef.clearSelection()
    },
    // 动态获取类名样式 是否让编辑框显示
    getClassName(cell) {
      for (let i = 0; i < document.getElementsByClassName('current-cell').length; i++) {
        document.getElementsByClassName('current-cell')[i].classList.remove('current-cell')
      }
      cell.classList.add('current-cell')
    },
    // 动态给每一个单元格 加上唯一的索引 官网这样说的
    cellClassName({ row, column, rowIndex, columnIndex }) {
      row.index = rowIndex
      column.index = this.activeName === '服务明细信息' && this.ischange ? columnIndex + 1 : this.activeName === '服务明细信息' ? columnIndex : columnIndex + 1
      if (!row.childNodeList && columnIndex === 0) { // 没有childNodeList 则将多选框隐藏
        return 'table-column-hidden'
      } else {
        return 'column'
      }
    },
    // 列表表格点击事件
    async handlerClick(row, prop, cell, event) {
      const { type } = this.urlData
      const NODE_TYPES = ['sett_01', 'confirm_01']

      const id = type === 'todo' && (NODE_TYPES.includes(this.currentNode) || this.isSubCheckEidt)
        ? this.OnCellBeginEdit(row, prop, this.activeName, this.getTable, this.currentNode)
        : ''
      // 将点击的单元格id赋值给editIndex
      this.editIndex = id
      // input默认聚焦
      this.$nextTick(() => {
        for (let i = 0; i < this.$refs.tableInput?.length; i++) {
          this.$refs.tableInput[i].focus()
        }
      })
      // 暂存点击某一行的值
      this.temporary = row[prop.property]
      this.getClassName(cell)
      this.$emit('rowClick', [row, prop, this.temporary])
    },
    // 数组汉化
    numChinsese(number) {
      const digitMap = {
        '1': '一',
        '2': '两',
        '3': '三',
        '4': '四',
        '5': '五',
        '6': '六',
        '7': '七',
        '8': '八',
        '9': '九',
        '0': '零'
      }
      return digitMap[number] || number // 如果输入的不是'1'或'2'，则返回原数字
    },
    // 根据传进来的精度返回符合要求的正则表达式
    createDecimalRegex(decimalPlaces, status) {
      if (decimalPlaces < 0) {
        throw new Error('decimalPlaces 必须是非负整数')
      }
      let result = ''
      // 正则表达式模板
      const decimalPart = `(\\.${`\\d{1,${decimalPlaces}}`})?`
      // 没有小数
      if (+decimalPlaces === 0) {
        result = status ? /^(-)?[1-9]\d*$/ : /^[1-9]\d*$/
      } else {
        // true 可以输入负数 否则只能正数
        result = status ? new RegExp(`^(-)?\\d+${decimalPart}$`) : new RegExp(`^\\d+${decimalPart}$`)
      }
      return result
    },
    // 1.校验非法输入
    checkVerifyInput(row, item, index, type1) {
      let flag = true
      // 新需求服务调数量限制4位小数
      const _spuUnitAcc = this.activeName === '服务明细信息' && item === 'changeNum' ? 4 : (+row['spuUnitAcc'])
      const actions = {
        'changePrice': () => this.$alert('输入不正确！请输入正确的数值', '系统提示', {
          confirmButtonText: '确定',
          cancelButtonClass: 'pms-zr-button'
        }),
        'adjustedPrice': () => this.$alert('输入不正确！请输入正确的数值', '系统提示', {
          confirmButtonText: '确定',
          cancelButtonClass: 'pms-zr-button'
        }),
        'verifyInput': () => this.$message({
          message: '非法字符！',
          type: 'warning'
        }),
        defaultsMessage: () => this.promtTitleMessage(this.numChinsese(_spuUnitAcc)) // // 新需求服务调数量限制4位小数
      }
      // 输入为空提示
      if (row[item] === '') {
        const action = actions[item] || actions.defaultsMessage
        action()
        this.$emit('inputChange', [item, index, row])
      } else if (type1) {
        // 非法输入
        row[item] = this.temporary ? this.temporary : ''
        actions['verifyInput']()
      } else {
        flag = false
      }
      return flag
    },
    // 2.服务特殊合价校验
    serviceSpecialVerify(serviceSpecialOne, serviceSpecialTwo, serviceSpecialThree, row, item, index) {
      let flag = true
      const actions = {
        'one': () => this.$message({
          message: '当前调整订单及同订单累计合价（不含税）金额小于等于零，只可输入正数，不可输入负数',
          type: 'warning'
        }),
        'two': () => this.$message({
          message: '累计合价（不含税）金额大于0，调减后的变化后合价金额需要大于等于0',
          type: 'warning'
        })
      }
      if (serviceSpecialOne) {
        row[item] = this.temporary ? this.temporary : ''
        actions['one']()
      } else if (serviceSpecialTwo && serviceSpecialThree) {
        row[item] = this.temporary ? this.temporary : ''
        actions['two']()
      } else if (serviceSpecialTwo && !serviceSpecialThree) {
        this.$emit('inputChange', [item, index, row])
      } else {
        flag = false
      }
      return flag
    },
    // 3.校验输入0
    serviceSpecialThreeVerify(serviceSpecialFour, serviceSpecialFive, row, item, index) {
      let flag = true
      const actions = {
        'one': () => this.promtTitleMessage(this.numChinsese(row['spuUnitAcc']), '不允许输入0,'),
        'two': () => this.promtTitleMessage(this.numChinsese(row['spuUnitAcc']), '不能输入负数,'),
        'three': () => this.promtTitleMessage(this.numChinsese(row['spuUnitAcc']))
      }
      if (serviceSpecialFour) {
        row[item] = this.temporary ? this.temporary : ''
        actions['one']()
      } else if (serviceSpecialFive) {
        // 判断上一次值是否存在
        const show = +row[item] < 0 ? 'two' : 'three'
        actions[show]()
        row[item] = this.temporary ? this.temporary : ''
        this.$emit('inputChange', [item, index, row])
      } else {
        flag = false
      }
      return flag
    },
    serviceSpecialFourVerifyOne(item, decimalLength, row) {
      return (item !== 'changePrice' && item !== 'adjustedPrice') && decimalLength > +row['spuUnitAcc'] && this.activeName !== '服务明细信息'
    },
    serviceSpecialFourVerifyTwo(item, decimalLength) {
      return this.activeName === '服务明细信息' && item === 'changeNum' && decimalLength > 4
    },
    serviceSpecialFourVerifyThree(item, row) {
      return this.activeName === '物资明细信息' && (+row[item]) < 0
    },
    serviceSpecialFourVerifyFive() {
      return this.temporary ? this.temporary : ''
    },
    // 4.校验
    serviceSpecialFourVerify(serviceSpecialSix, serviceSpecialSeven, serviceSpecialEight, row, item, index) {
      // 服务变化数量changeNum 最多可输入4位小数
      const _spuUnitAcc = this.activeName === '服务明细信息' && item === 'changeNum' ? 4 : (+row['spuUnitAcc'])
      let flag = true
      const actions = {
        'one': () => this.promtTitleMessage(this.numChinsese(_spuUnitAcc)),
        'two': () => this.promtTitleMessageCopy(this.numChinsese(_spuUnitAcc))
      }
      if (serviceSpecialSix) {
        row[item] = this.serviceSpecialFourVerifyFive()
        actions['one']()
      } else if (serviceSpecialSeven || serviceSpecialEight) {
        const decimalLength = row[item].toString().split('.')[1]?.length || 0
        if (this.serviceSpecialFourVerifyTwo(item, decimalLength)) {
          row[item] = this.serviceSpecialFourVerifyFive()
          actions['one']()
          return
        }
        if (this.serviceSpecialFourVerifyOne(item, decimalLength, row)) {
          row[item] = this.serviceSpecialFourVerifyFive()
          actions['one']()
          return
        }
        // 物资不允许输入小数
        if (this.serviceSpecialFourVerifyThree(item, row)) {
          row[item] = this.serviceSpecialFourVerifyFive()
          actions['two']()
          return
        }
        this.$emit('inputChange', [item, index, row])
      } else {
        flag = false
      }
      return flag
    },
    // input框填完成以后的回调2024.9.26优化代码
    changeInput(item, index, row) {
      const sumTotal = this.getCalaEquipSum(row)
      // 不能输入中文、不能输入特殊字符、不能输入英文
      const type1 = !regex['first'].test(row[item])
      // 新需求服务调数量限制4位小数
      const _spuUnitAcc = this.activeName === '服务明细信息' && item === 'changeNum' ? 4 : (+row['spuUnitAcc'])
      // 根据后端返回的精度返回符合要求的正则
      const initRegex = this.createDecimalRegex(_spuUnitAcc, false)
      const initRegexSecond = this.createDecimalRegex(_spuUnitAcc, true)
      const regexPattern = /^(?!0\d)\d*(?:\.\d{1,2})?$/
      const serviceSpecialOne = this.changeInputOne(row, sumTotal, item)
      const serviceSpecialTwo = this.changeInputTwo(row, item)
      const serviceSpecialThree = this.changeInputThree(row, sumTotal, item)
      const serviceSpecialFour = this.changeInputFour(row, item)
      const serviceSpecialFive = this.changeInputFive(regexPattern, row, item)
      const serviceSpecialSix = this.changeInputSix(initRegexSecond, row, item)
      const serviceSpecialSeven = this.changeInputSeven(initRegexSecond, row, item)
      const serviceSpecialEight = this.changeInputEight(initRegex, row, item)
      if (!shouleChineseTitle.includes(item)) {
        // 1.校验非法输入
        if (this.checkVerifyInput(row, item, index, type1)) {
          return
        }
        // 2.特殊合价不含税
        if (this.serviceSpecialVerify(serviceSpecialOne, serviceSpecialTwo, serviceSpecialThree, row, item, index)) {
          return
        }
        // 3.第三次校验
        if (this.serviceSpecialThreeVerify(serviceSpecialFour, serviceSpecialFive, row, item, index)) {
          return
        }
        // 4.校验
        if (this.serviceSpecialFourVerify(serviceSpecialSix, serviceSpecialSeven, serviceSpecialEight, row, item, index)) {
          return
        }
      }
      this.$emit('inputChange', [item, index, row])
    },
    changeInputOne(row, sumTotal, item) {
      return this.activeName === '服务明细信息' && sumTotal <= 0 && (+row[item]) < 0
    },
    changeInputTwo(row, item) {
      return this.activeName === '服务明细信息' && ((+row.equipSum) < 0 || (+row.equipSum) > 0) && item !== 'changeNum'
    },
    changeInputThree(row, sumTotal, item) {
      return sumTotal > 0 && (+row[item]) < 0 && Math.abs(+row[item]) > Math.abs(sumTotal)
    },
    changeInputFour(row, item) {
      return noAllodZeroList.includes(item) && (+row[item] === 0)
    },
    changeInputFive(regexPattern, row, item) {
      return !regexPattern.test(row.currentAmount) && item === 'currentAmount'
    },
    changeInputSix(initRegexSecond, row, item) {
      return !initRegexSecond.test(+row[item]) && item === 'changeNum' && this.activeName === '服务明细信息'
    },
    changeInputSeven(initRegexSecond, row, item) {
      return initRegexSecond.test(+row[item]) && item === 'changeNum' && this.activeName === '服务明细信息'
    },
    changeInputEight(initRegex, row, item) {
      return !initRegex.test(+row[item]) && (item !== 'changePrice' && item !== 'adjustedPrice')
    },
    promtTitleMessage(unit, title = '') {
      this.$alert(`输入不正确！${unit === '零' ? '只能输入整数' : `${title}只能输入最多${unit}位小数的数据！`}`, '系统提示', {
        confirmButtonText: '确定',
        cancelButtonClass: 'pms-zr-button'
      })
      return
    },
    promtTitleMessageCopy(unit, title = '') {
      this.$alert(`输入不正确！${unit === '零' ? '只能输入正整数' : `${title}只能输入最多${unit}位小数的正数！`}`, '系统提示', {
        confirmButtonText: '确定',
        cancelButtonClass: 'pms-zr-button'
      })
      return
    },
    //  鼠标离开单元格移除类名
    removeClass(item, index, row) {
      document
        .getElementsByClassName('current-cell')[0]
        .classList.remove('current-cell')
    },
    // 判断是否勾选上多选框
    isExist(row) {
      let isChecked = false
      if (Number(row) === 1) {
        isChecked = true
      } else {
        isChecked = false
      }
      return isChecked
    },
    // 选择之后回传的值 val:true/false prop:key
    selectChange(val, prop) {
      this.$emit('selectChange', val)
    },
    // input 选择之后聚焦事件
    getDatalist(row, item) {
      // 这个是有个开关需要把当前数据服务商放进去
      this.$emit('isClose', [row, item])
    },
    // 将对象属性进行更改
    replaceValuesInObject(targetObj, sourceObj) {
      for (const key in sourceObj) {
        if (key in targetObj) {
          targetObj[key] = sourceObj[key]
        }
      }
      return targetObj
    },
    /**
     *
     * @param {*} item  serviceName 表格的prop
     * @param {*} row 当前行
     * @param {*} label id
     * @param {*} type 字段 PROVIDERS
     */
    // select选择以后触发的事件
    handleOnEvent(item, row, label, type) {
      // 判断当前的字段类型
      const findType = item === 'serviceName' ? 'serviceCode' : 'serviceUserId'
      const options = this.servicesSelect[type].find(_item => _item[findType] === label)
      // 将多选框的选中的值进行替换
      this.replaceValuesInObject(row, options)
      this.$emit('selectInfo', [item, row, label])
    },
    // 查看编辑按钮
    operationClick(item, row, type) {
      if (type) {
        this.$emit('operationBtn', [item, row])
      }
    },
    // 是否可以禁止
    isDisableShow(row, item) {
      const { type } = this.urlData
      let flag = false
      if (Number(row.isExistServiceFlow) > 0 || Number(row.isExistNotServiceAdjust) === 0) {
        flag = true
      } else if ((row.serviceCode === row.supplierCode) && item === 'serviceName' && +row.isContainSupplier === 1) {
        flag = true
      } else if (this.currentNode !== 'sett_01') {
        flag = true
      } else if (type === 'done') {
        flag = true
      } else {
        flag = false
      }
      return flag
    },
    // 是否显示合计二字
    isShowPrice(item, row) {
      const typesTitle = ['amt', 'equipSum', 'doneNum', 'donePrice']
      if (typesTitle.includes(item.prop) && row.childNodeList) {
        return true
      } else {
        return false
      }
    },
    // 单元格是否可以编辑
    async cellIsEdits() {
      // 从浏览器地址栏获取  判断当前是那个节点
      const { workItemId, type } = this.urlData
      if (!workItemId || type === 'done') {
        // 不让编辑&&不允许改变单元格颜色
        this.currentNode = 'empty'
        return
      }
      const { code, data } = await getWFWorkItem({ workItemId: workItemId })
      if (+code === 200) {
        this.currentNode = data.activityDefID
      }
    },
    getCalaEquipSum(row) {
      let sumTotal = ''
      if (this.activeName === '服务明细信息') {
        // 针对服务需要判断如何调增调减
        const saveEqual = this.getTable.map(item => {
          if (item.childNodeList && item.childNodeList.length > 0) {
            // 只取服务编码 和订单号相同的
            return item.childNodeList.filter(_item => (_item.orderNo === row.orderNo && _item.categoryCode === row.categoryCode))
          }
        })
        // 将二维数组转为一维数组
        const toChangeList = saveEqual.flat()
        // 合价不含税累计合
        sumTotal = toChangeList.reduce((accumulator, currentObject) => (+accumulator) + (+currentObject.equipSum), 0)
      }
      return sumTotal
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewMateriaOne(prop, row) {
      const _arr = ['changeNum', 'usableStorage', 'unUsableStorage', 'notUsableStorage', 'notUnusableStorage']
      return (_arr.includes(prop.property) || this.optimizeNewMateriaThree(prop, row)) && this.optimizeNewMateriaTwo(row)
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewMateriaTwo(row) {
      return +row.proType === 0 && +row.isPush === 0 && +row.isPushAudit !== 1 && +row.outPutType !== 25
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewMateriaThree(prop, row) {
      return (prop.property === 'storeManName' && +row.fieldProjectManager === 1) || prop.property === 'storeManNum' || prop.property === 'storageAddress'
    },
     // 2024-10-10 阻断问题if过多解决方案
     optimizeNewMateriaFour(prop, row) {
      return (prop.property === 'changeNum' && this.optimizeNewMateriaFive(row)) && +row.proType === 0
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewMateriaFive(row) {
      return (this.optimizeNewMateriaSix(row) || this.optimizeNewMateriaSeven(row) || this.optimizeNewMateriaEight(row) || this.optimizeNewMateriaNine(row))
    },
     // 2024-10-10 阻断问题if过多解决方案
     optimizeNewMateriaSix(row) {
      return (+row.notUnusableStorage !== 0 && row.notUnusableStorage !== null && row.notUnusableStorage !== undefined && row.notUnusableStorage !== '')
    },
    optimizeNewMateriaSeven(row) {
      return (+row.notUsableStorage !== 0 && row.notUsableStorage !== null && row.notUsableStorage !== undefined && row.notUsableStorage !== '')
    },
    optimizeNewMateriaEight(row) {
      return (+row.unUsableStorage !== 0 && row.unUsableStorage !== null && row.unUsableStorage !== undefined && row.unUsableStorage !== '')
    },
    optimizeNewMateriaNine(row) {
      return (+row.usableStorage !== 0 && row.usableStorage !== null && row.usableStorage !== undefined && row.usableStorage !== '')
    },
    optimizeNewMateriaTen(prop, row) {
      const _arr = ['usableStorage', 'unUsableStorage', 'notUsableStorage', 'notUnusableStorage']
      return ((_arr.includes(prop.property)) && this.optimizeNewMateriaEleve(row)) && +row.proType === 0
    },
    optimizeNewMateriaEleve(row) {
      return (+row.changeNum !== 0 && row.changeNum !== null && row.changeNum !== undefined && row.changeNum !== '')
    },
    optimizeNewMateriaTwelve(prop, row) {
      const _arrs = ['storeManName', 'storeManNum', 'storageAddress']
      return ((_arrs.includes(prop.property)) && this.optimizeNewMateriaThirteen(row)) && +row.proType === 0
    },
    optimizeNewMateriaThirteen(row) {
      return (this.optimizeNewMateriaFourteen(row) && this.optimizeNewMateriaFifteen(row))
    },
    optimizeNewMateriaFourteen(row) {
      return (+row.notUsableStorage === 0 || row.notUsableStorage === undefined || row.notUsableStorage === '')
    },
    optimizeNewMateriaFifteen(row) {
      return (+row.notUnusableStorage === 0 || row.notUnusableStorage === undefined || row.notUnusableStorage === '')
    },
    optimizeNewMateriaSixteen(activeName) {
      return activeName === '服务明细信息' || activeName === ''
    },
    getCheckMaterialDisable(prop, row, copyNeedId) {
        if ((prop.property === 'notUsableStorage' || prop.property === 'notUnusableStorage') && +row.isRetreatConfig === 0) {
           return ''
        } else {
           return copyNeedId
        }
    },
    OnCellBeginEdit(row, prop, activeName, tableData, currentNode) {
      const sumTotal = this.getCalaEquipSum(row)
      // 需要返回的id
      let needId = ''
      const { id } = this.findOnlyId(tableData, row.id)
      // 按照1.0单元格编辑前逻辑验证 很复杂...
      if (activeName === '物资明细信息') {
        // 判断当前点击的是那个单元格
        // 如果点击的是增调数量/入库可用/入库不可用/不入库可用/不入库不可用 保管人联系方式 地址
        if (this.optimizeNewMateriaOne(prop, row)) {
          // 赋值id
          needId = id
        }
        // 如果是增调数量 &&入库不可用！==0如可可用！==null
        if (this.optimizeNewMateriaFour(prop, row)) {
          // 让id=空
          needId = ''
        }
        // 如果是入库可用
        if (this.optimizeNewMateriaTen(prop, row)) {
          // 让id=空
          needId = ''
        }
        // 如果是地址或者保管人联系方式
        if (this.optimizeNewMateriaTwelve(prop, row)) {
          // 让id=空
          needId = ''
        }
        needId = this.getCheckMaterialDisable(prop, row, needId)
      }
      if (this.optimizeNewMateriaSixteen(activeName)) {
        needId = activeName === '' ? id : this.handleServiceDetail(currentNode, row, prop.property, id, sumTotal)
      }
      return needId
    },
    // 处理服务明细是否可以编辑
    handleServiceDetail(currentNode, row, item, id, sumTotal) {
      let _ids = ''
      if (row.childNodeList) {
        _ids = '' // 存在子节点，不让父节点编辑
      } else {
        _ids = currentNode === 'confirm_01' ? this.serviceSupplierConfirm(row, item, id, sumTotal) : this.OnCellBeginEditService(row, item, id, sumTotal)
      }
      return _ids
    },
    /**
         * 查找唯一id
         * @param {*} tableData 表格数据
         * @param {*} id  唯一id
         * @returns object
         */
    findOnlyId(tableData, id) {
      // 定义初始值为null 给下面的值做准备
      let result = null
      // 如果符合条件则递归进行遍历
      const findRecursively = (obj) => {
        // 判断当前对象里面的id 和点击单元格id是否一致
        if (obj.id === id) {
          // 将当前obj 赋值给result
          result = obj
          return true
        }
        // 如果该对象存在字节点 递归
        if (obj.childNodeList) {
          // 递归遍历childNodeList每一项之后返回给result
          result = obj.childNodeList.find(child => findRecursively(child))
        }
        return result
      }
      // 查找表格中find以后是否存在有的话递归遍历
      tableData.find(obj => findRecursively(obj))
      return result
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewServiceOne(billType, row) {
      return +billType === 30 || (+row.equipSum) < 0
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewServiceTwo(item, isPushAudit, ifConfirm, allowAdjustment) {
      return item === 'returnInforMation' && +isPushAudit !== 1 && +ifConfirm === 1 && +allowAdjustment === 0
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewServiceThree(item, isPushAudit, allowAdjustment, epcServiceType,adjustmentStatus) {
      const arrs_ = [4, 14]
      return item === 'changePrice' && +isPushAudit !== 1 && this.optimizeNewServiceNineOnes(allowAdjustment, adjustmentStatus) && (arrs_.includes(+epcServiceType))
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewServiceFour(item, ifsb, isPushAudit, allowAdjustment, epcServiceType, id, _backId,adjustmentStatus) {
        let backId = _backId
        // 如果+ifsb ！===0 符合条件进入该逻辑
        if (+ifsb !== 0) {
          // 如果是增调数量
          if (this.optimizeNewServiceFive(item, isPushAudit, allowAdjustment, epcServiceType,adjustmentStatus)) {
            // 赋值id 可以编辑
            backId = id
          }
        }
        // 如果是合价
        if (this.optimizeNewServiceSeven(item, isPushAudit, allowAdjustment,adjustmentStatus)) {
          // 赋值id 可以编辑
          backId = id
        }
        return backId
    },
    optimizeNewServiceFive(item, isPushAudit, allowAdjustment, epcServiceType,adjustmentStatus) {
      return this.optimizeNewServiceSix(item, isPushAudit, allowAdjustment,adjustmentStatus) && !(+epcServiceType === 4 || +epcServiceType === 14)
    },
    optimizeNewServiceSix(item, isPushAudit, allowAdjustment,adjustmentStatus) {
      return item === 'changeNum' && +isPushAudit !== 1 && (+allowAdjustment === 1||+adjustmentStatus===0)
    },
    optimizeNewServiceSeven(item, isPushAudit, allowAdjustment,adjustmentStatus) {
      return item === 'changePrice' && +isPushAudit !== 1 && (+allowAdjustment === 1||+adjustmentStatus===0)
    },
    optimizeNewServiceEight(item, ifModularization, isPushAudit, allowAdjustment, epcServiceType, id, _backId,adjustmentStatus) {
      let backId = _backId
        if (this.optimizeNewServiceNine(item, isPushAudit, allowAdjustment, epcServiceType,adjustmentStatus)) {
          // 赋值id 可以编辑
          backId = id
        }
        // 如果是单价
        if (this.optimizeNewServiceTen(item, ifModularization, isPushAudit, allowAdjustment,adjustmentStatus)) {
          // 赋值id 可以编辑
          backId = id
        }
        return backId
    },
    optimizeNewServiceNine(item, isPushAudit, allowAdjustment, epcServiceType,adjustmentStatus) {
      const arrs_ = [4, 14]
      return item === 'changeNum' && +isPushAudit !== 1 && this.optimizeNewServiceNineOnes(allowAdjustment, adjustmentStatus) && !(arrs_.includes(+epcServiceType))
    },
    optimizeNewServiceNineOnes(allowAdjustment, adjustmentStatus){
      return (+allowAdjustment === 1||+adjustmentStatus===0)
    },
    optimizeNewServiceTen(item, ifModularization, isPushAudit, allowAdjustment,adjustmentStatus) {
      return item === 'adjustedPrice' && +ifModularization === 0 && +isPushAudit !== 1 && this.optimizeNewServiceNineOnes(allowAdjustment, adjustmentStatus)
    },
    optimizeNewServiceEleve(item, ifModularization, isPushAudit, allowAdjustment, id, _backId) {
        let backId = _backId
        if (this.optimizeNewServiceTweleve(item, ifModularization, isPushAudit, allowAdjustment)) { // 模块化:变化数量--》可更改
          // 赋值id 可以编辑
          backId = id
        }
         if (this.optimizeNewServiceThirteen(item, ifModularization, isPushAudit, allowAdjustment)) { // 非模块化：变化数量或单价不含税--》可更改选其一
          // 赋值id 可以编辑  非模块化
          backId = id
        }
        // 变化合价
        if (this.optimizeNewServiceFourteen(item, isPushAudit, allowAdjustment)) { // 其他、模块化、非模块化：变化合价--》可更改
          // 赋值id 可以编辑
          backId = id
        }
        return backId
    },
    optimizeNewServiceTweleve(item, ifModularization, isPushAudit, allowAdjustment) {
      return +ifModularization === 1 && item === 'changeNum' && +isPushAudit !== 1 && (+allowAdjustment === 1)
    },
    optimizeNewServiceThirteen(item, ifModularization, isPushAudit, allowAdjustment) {
      const arrs = ['changeNum', 'adjustedPrice']
      return +ifModularization === 0 && arrs.includes(item) && +isPushAudit !== 1 && (+allowAdjustment === 1)
    },
    optimizeNewServiceFourteen(item, isPushAudit, allowAdjustment) {
      return item === 'changePrice' && +isPushAudit !== 1 && (+allowAdjustment === 1)
    },
    OnCellBeginEditServicerepaierOnes(row,allowAdjustment,adjustmentStatus,isPushAudit) {
     return +row['amount'] === 0&&(+allowAdjustment === 1||+adjustmentStatus===0)&&+isPushAudit !== 1
    },
    // 服务明细调整单元格编辑前验证
    OnCellBeginEditService(row, item, id, sumTotal) {
      // 定义一个id
      let backId = ''
      // changePrice 变化合价   changeNum 变化数量 adjustedPrice 调整后单价(不含税) returnInforMation 回退调整意见
      const { billType, ifModularization, ifsb, isPushAudit, allowAdjustment, adjustmentStatus, epcServiceType, ifConfirm, status } = row
      // 在建损失 负数订单不允许编辑
      if (this.optimizeNewServiceOne(billType, row)) {
        // 让id=空
        backId = ''
        return backId
      }
      // 如果是回退调整意见 都不满足则不允许编辑  && +status === 1
      if (this.optimizeNewServiceTwo(item, isPushAudit, ifConfirm, allowAdjustment)) {
        // 让id存在
        backId = id
      }
      // 订单数量为0的情况下，只允许调增，且只支持调增变化数量
      if (this.OnCellBeginEditServicerepaierOnes(row,allowAdjustment,adjustmentStatus,isPushAudit)) {
        const enum_obj = {
          'changeNum': id,
          'adjustedPrice': '',
          'changePrice': ''
        }
        return enum_obj[item]
      }
      // 是否模块化 是否模块化(1模块化 0 非模块化 -1 其他)
      if (ifModularization === '-1') {
        backId = this.optimizeNewServiceFour(item, ifsb, isPushAudit, allowAdjustment, epcServiceType, id, backId,adjustmentStatus)
      } else {
        // “模块化”服务类订单仅允许调整数量；
        // “非模块化”服务类订单允许调整数量或调整单价金额，两种调整方式操作人可任选一种；
        backId = this.optimizeNewServiceEight(item, ifModularization, isPushAudit, allowAdjustment, epcServiceType, id, backId,adjustmentStatus)
      }
      // 是否合价
      if (this.optimizeNewServiceThree(item, isPushAudit, allowAdjustment, epcServiceType,adjustmentStatus)) {
        // 赋值id 可以编辑
        backId = id
      }
      // 判断物料编码五级分类符合下列条件且组合件标识为“是”的工程服务编码属于总包服务
      if (this.judgeIsTurnkeyServices(row)) {
        // 判断当前属于模块化&&是增调数量
        backId = this.optimizeNewServiceEleve(item, ifModularization, isPushAudit, allowAdjustment, id, backId)
      }
      return backId
    },
    // 2024-10-10 阻断问题if过多解决方案
    optimizeNewSupplierOne(billType, row) {
      return +billType === 30 || (+row.equipSum) < 0
    },
    optimizeNewSupplierTwo(item, ifsb, isPushAudit, ifConfirm, epcServiceType, id, _backId) {
        let backId = _backId
        if (this.optimizeNewSupplierFour(ifsb, item, isPushAudit, ifConfirm, epcServiceType)) {
          // 赋值id 可以编辑
          backId = id
        }
        // 变化合价
        if (this.optimizeNewSupplierThree(item, isPushAudit, ifConfirm)) {
          // 赋值id 可以编辑
          backId = id
        }
        return backId
    },
    optimizeNewSupplierThree(item, isPushAudit, ifConfirm) {
      return item === 'changePrice' && +isPushAudit !== 1 && +ifConfirm !== 1
    },
    optimizeNewSupplierFour(ifsb, item, isPushAudit, ifConfirm, epcServiceType) {
      const arrs_ = [4, 14]
      return this.optimizeNewSupplierFive(item, ifsb, isPushAudit, ifConfirm) && !(arrs_.includes(+epcServiceType))
    },
    optimizeNewSupplierFive(item, ifsb, isPushAudit, ifConfirm) {
      return +ifsb !== 0 && item === 'changeNum' && +isPushAudit !== 1 && +ifConfirm !== 1
    },
    optimizeNewSupplierSix(item, isPushAudit, ifConfirm, epcServiceType, ifModularization, id, _backId) {
      let backId = _backId
      if (this.optimizeNewSupplierEight(item, isPushAudit, ifConfirm, epcServiceType)) {
          // 赋值id 可以编辑
          backId = id
        }
        // 如果是单价
        if (this.optimizeNewSupplierSeven(item, ifModularization, isPushAudit, ifConfirm)) {
          // 赋值id 可以编辑
          backId = id
        }
        return backId
    },
    optimizeNewSupplierSeven(item, ifModularization, isPushAudit, ifConfirm) {
      return item === 'adjustedPrice' && +ifModularization === 0 && +isPushAudit !== 1 && +ifConfirm !== 1
    },
    optimizeNewSupplierEight(item, isPushAudit, ifConfirm, epcServiceType) {
      const arrs_ = [4, 14]
      return item === 'changeNum' && +isPushAudit !== 1 && +ifConfirm !== 1 && !(arrs_.includes(+epcServiceType))
    },
    optimizeNewSupplierNine(item, epcServiceType, ifConfirm) {
      const arrs_ = [4, 14]
      return item === 'changePrice' && (arrs_.includes(+epcServiceType)) && +ifConfirm !== 1
    },
    serviceSupplierConfirmrepairOnes(row,isPushAudit){
      return +row['amount'] === 0&&+isPushAudit !== 1
    },
    // 服务供应商确认代办,
    serviceSupplierConfirm(row, item, id, sumTotal) {
      let backId = ''
      // adjustedPrice 调整后单价(不含税) changePrice 变化合价  changeNum 变化数量
      const { billType, ifModularization, ifsb, isPushAudit, epcServiceType, ifConfirm } = row
      // 在建损失 负数订单不允许编辑
      if (this.optimizeNewSupplierOne(billType, row)) {
        // 让id=空
        backId = ''
        return backId
      }
      // 订单数量为0的情况下，只允许调增，且只支持调增变化数量
      if (this.serviceSupplierConfirmrepairOnes(row,isPushAudit)) {
        const enum_obj = {
          'changeNum': id,
          'adjustedPrice': '',
          'changePrice': ''
        }
        return enum_obj[item]
      }
      // 是否模块化 是否模块化(1模块化 0 非模块化 -1 其他)
      if (ifModularization === '-1') {
        // 判断如果该条件符合则进入该逻辑
       backId = this.optimizeNewSupplierTwo(item, ifsb, isPushAudit, ifConfirm, epcServiceType, id, backId)
      } else {
        // “模块化”服务类订单仅允许调整数量；
        // “非模块化”服务类订单允许调整数量或调整单价金额，两种调整方式操作人可任选一种；
        backId = this.optimizeNewSupplierSix(item, isPushAudit, ifConfirm, epcServiceType, ifModularization, id, backId)
      }
      // 如果是合价
      if (this.optimizeNewSupplierNine(item, epcServiceType, ifConfirm)) { // 总包类服务异常数据修改时控制只能调整金额，不能调整数量；
        // 赋值id 可以编辑
        backId = id
      }
      return backId
    },
    // 判断是否总包服务并且为组合件
    judgeIsTurnkeyServices(record) {
      const turnkeyServicesCategoryCodes = [
        '9030010109', '9030010207', '9030020107', '9030020204',
        '9030020301', '9030030106', '9030030206', '9030070104',
        '9030070202', '9030010110', '9030020108', '9030020302',
        '9030030107', '9030030207', '9030070105'
      ]
      const { categoryCode, ifMulti } = record
      const isTurnkeyService = turnkeyServicesCategoryCodes.includes(categoryCode.substr(0, 10)) && ifMulti === '0'
      return isTurnkeyService
    }

  }
}
</script>

<style lang="scss" scoped>
.myTable .el-input {
  display: none;
}

.current-cell .el-input {
  display: block;
}

.current-cell .el-input+span {
  display: none;
}

.slotContent {
  // flex: 1;
  width: 100%;
}

::v-deep .pms-button-primary {
  color: #fff;
}

.headers-tooltips {
  width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  text-align: left;
}

.header-tooltip {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.header-tooltips {
  width: 100%;
  display: block;
  cursor: pointer;
}

.rowItem {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

::v-deep .el-table__expand-icon {
  z-index: 1;
}

::v-deep .el-table__row .el-table__expand-column .cell:hover {
  background: none;
}

.demo-table-expand {
  font-size: 0;
  width: 100%;
  padding-top: 8px;
}

.demo-table-expand ::v-deep .el-form-item {
  width: 350px !important;
}

.demo-table-expand ::v-deep .add-color .el-form-item__label {
  color: red !important;
}

::v-deep .el-form-item__label {
  color: #00BFBF;
}

.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}

.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}

::v-deep .el-form-item .el-form-item__content {
  width: auto;
  color: #606266;
  font-size: 12px;
}

::v-deep .el-form-item__label {
  width: 140px;
  text-align: left;
  margin-left: 53px;
  line-height: 25px;
}

::v-deep .el-table__fixed-right {
  height: 100% !important; //设置高优先，以覆盖内联样式
}

::v-deep .el-table__fixed {
  height: 100% !important; //设置高优先，以覆盖内联样式
}

::v-deep .el-table thead .is-group th.el-table__cell:nth-last-child(2) {
  color: black !important;

}

::v-deep .el-input__inner {
  height: 22px !important;
  font-size: 12px !important;
  padding-left: 6px;
  box-sizing: border-box;
}

::v-deep .el-select {
  padding: 2px 0;
}

::v-deep .el-table__row td:nth-last-child(2) .cell .el-select .el-input__inner {
  // width: 232px;
}

::v-deep .el-input__icon {
  line-height: 26px;
}

::v-deep .el-table-column--selection .cell:nth-child(1) {
  padding-right: 10px;
}

::v-deep .el-table th.el-table__cell:nth-last-child(2) {
  color: #333333;

}

::v-deep .el-table__row td:nth-child(2) .cell {
  display: flex;
  align-items: center;
  padding-left: 2px;
  justify-content: center;
}

::v-deep .el-table__row td:last-child .cell .el-checkbox__inner {
  cursor: not-allowed;
}

::v-deep .el-table__row td:nth-child(3) .cell {
  display: flex;
  justify-content: center;
}

::v-deep .el-table__row td:nth-child(2) .el-table__expand-icon {
  margin-left: 10px;
}

::v-deep .el-table__row td:nth-child(2) .cell:first-child .el-table__expand-icon {
  padding-right: 6px;
}

::v-deep .el-table__row td:nth-child(2) .cell:last-child .header-tooltip {
  // width: 65px;
  text-align: center;
}

.look {
  color: red
}

.edits {
  color: #02A7F0;
}

::v-deep .el-table__row .table-column-hidden .el-checkbox__inner {
  display: none;
}
</style>
